﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.QueryEntity;

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    public class TaskMgtService : ITaskMgtService
    {
        public string DeleteTaskDetail(List<string> taskDetailID, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new TaskMgtBLL(pubParasInfo).DeleteTaskDetail(taskDetailID);
                new OperationLogBLL(pubParasInfo).Insert("TaskMgtService_DeleteTaskDetail", taskDetailID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return returnStr;
        }

        public string DeleteTaskManagerUser(List<string> taskDetailID, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new TaskManagerUserBLL(pubParasInfo).DeleteTaskManagerUser(taskDetailID);
                new OperationLogBLL(pubParasInfo).Insert("TaskMgtService_DeleteTaskManagerUser", taskDetailID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return returnStr;
        }

        public string DeleteTaskManagerUserDetail(string userID, List<string> lineID, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new TaskManagerUserDetailBLL(pubParasInfo).DeleteTaskManagerUserDetail(userID, lineID);
                new OperationLogBLL(pubParasInfo).Insert("TaskMgtService_DeleteTaskManagerUserDetail", userID, lineID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return returnStr;
        }

        public DataSet GetAllTaskDetail(PubParasInfo pubParasInfo)
        {
            try
            {
                TaskMgtBLL taskMgt = new TaskMgtBLL(pubParasInfo);
                return taskMgt.GetAllTaskDetail();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return null;
        }

        public DataSet GetAllTaskManagerUser(PubParasInfo pubParasInfo)
        {
            try
            {
                TaskManagerUserBLL taskManagerUserBLL = new TaskManagerUserBLL(pubParasInfo);
                return taskManagerUserBLL.GetAllTaskManagerUser();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return null;
        }

        public TaskDetailInfo GetTaskDetailByID(string taskdetailID, PubParasInfo pubParasInfo)
        {
            TaskDetailInfo taskDetailInfo = null;
            try
            {
                taskDetailInfo = new TaskMgtBLL(pubParasInfo).GetTaskDetailByID(taskdetailID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return taskDetailInfo;
        }

        public DataSet GetTaskDetailByQueryList(TaskDetailQueryEntity taskdetailQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                TaskMgtBLL taskMgt = new TaskMgtBLL(pubParasInfo);
                return taskMgt.GetTaskDetailByQueryList(taskdetailQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return null;
        }

        public TaskManagerUserInfo GetTaskManagerUserByID(string taskdetailID, PubParasInfo pubParasInfo)
        {
            TaskManagerUserInfo taskDetailInfo = null;
            try
            {
                taskDetailInfo = new TaskManagerUserBLL(pubParasInfo).GetTaskManagerUserByID(taskdetailID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return taskDetailInfo;
        }

        public DataSet GetTaskManagerUserByQueryList(TaskManagerUserQueryEntity taskdetailQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                TaskManagerUserBLL taskManagerUserBLL = new TaskManagerUserBLL(pubParasInfo);
                return taskManagerUserBLL.GetTaskManagerUserByQueryList(taskdetailQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return null;
        }

        public TaskManagerUserDetailInfo GetTaskManagerUserDetailByID(string userID, string lineID, PubParasInfo pubParasInfo)
        {
            TaskManagerUserDetailInfo taskManagerUserDetailInfo = null;
            try
            {
                taskManagerUserDetailInfo = new TaskManagerUserDetailBLL(pubParasInfo).GetTaskManagerUserDetailByID(userID, lineID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return taskManagerUserDetailInfo;
        }

        public string InsertTaskDetail(TaskDetailInfo taskDetailInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new TaskMgtBLL(pubParasInfo).InsertTaskDetail(taskDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TaskMgtService_InsertTaskDetail", taskDetailInfo, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return returnStr;
        }

        public string InsertTaskManagerUser(TaskManagerUserInfo taskDetailInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new TaskManagerUserBLL(pubParasInfo).InsertTaskManagerUser(taskDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TaskMgtService_InsertTaskManagerUser", taskDetailInfo, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return returnStr;
        }

        public string InsertTaskManagerUserDetail(TaskManagerUserDetailInfo taskManagerUserDetailInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new TaskManagerUserDetailBLL(pubParasInfo).InsertTaskManagerUserDetail(taskManagerUserDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TaskMgtService_InsertTaskManagerUserDetail", taskManagerUserDetailInfo, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return returnStr;
        }

        public string UpdateTaskDetail(TaskDetailInfo taskDetailInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new TaskMgtBLL(pubParasInfo).UpdateTaskDetail(taskDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TaskMgtService_UpdateTaskDetail", taskDetailInfo, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return returnStr;
        }

        public string UpdateTaskManagerUser(TaskManagerUserInfo taskDetailInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new TaskManagerUserBLL(pubParasInfo).UpdateTaskManagerUser(taskDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TaskMgtService_UpdateTaskManagerUser", taskDetailInfo, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return returnStr;
        }

        public string UpdateTaskManagerUserDetail(TaskManagerUserDetailInfo taskManagerUserDetailInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new TaskManagerUserDetailBLL(pubParasInfo).UpdateTaskManagerUserDetail(taskManagerUserDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TaskMgtService_UpdateTaskManagerUserDetail", taskManagerUserDetailInfo, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TaskMgtService异常");
            }
            return returnStr;
        }
    }
}

